<?
    include './common.php';
    $sql1 = "SELECT id,typename,pid FROM `type`";
    $res1 = mysqli_query($link,$sql1);
    $arr1=[];
    while($one = mysqli_fetch_assoc($res1)){
        $arr1[] = $one ;
    }
    $str1 = '' ;
    foreach( $arr1 as $key1=>$value1){
        $str1 .= "<option value={$value1['id']}>{$value1['typename']}</option>";
    }
    $sql2 = "SELECT * FROM `country`";
    $res2 = mysqli_query($link,$sql2);
    $arr2=[];
    while($one = mysqli_fetch_assoc($res2)){
        $arr2[] = $one ;
    }
    $str2 = '' ;
    foreach( $arr2 as $key2=>$value2){
        $str2 .= "<option value={$value2['id']}>{$value2['countryname']}</option>";
    }
    $selArr['select1'] = $str1 ; 
    $selArr['select2'] = $str2 ; 
    echo json_encode($selArr);
?>